{
    title:  'Multi-Language',
    crumbs: [
        { "User's Guide": '../users/' },
    ],
}
            <h1>Multi-Language Support</h1>
            <a id="overview"></a>
            <p>Appweb supports the ability to create and manage multi-language web applications. The support includes 
            a language-aware <a href="routing.html">Routing Engine</a> and a set of 
            <a href="configuration.html#directives">configuration file directives</a> to configure and control 
            response language selection.</p>
            <p>When a client sends a request, the HTTP headers typically include an <em>Accept-Language</em> HTTP header that
            specifies the client's language preference for the request. The Appweb routing engine listens for this
            header and will modify the request to select response content of the appropriate language.</p>
            <a id="documents"></a>
            <h2>Language Document Organization</h2>
            <p>There are two organization models supported by Appweb for multi-language applications:</p>
            <ul>
                <li>Separate directories for each language content, and </li>
                <li>Unified storage for content with a language suffix integrated into each document filename.</li>
            </ul>
            <p>Appweb manages these models via the <em>AddLanguageDir</em> and <em>AddLanguageSuffix</em>
            directives.</p>
            <a id="configuration"></a>
            <h2>Language Configuration Directives</h2>
            <p>Three directives control the language configuration on a per-route basis: 
            <em>AddLanguageDir</em>, <em>AddLanguageSuffix</em> and <em>DefaultLanguage</em>.
            <a id="isotag"></a>
            <h3>ISO Language Tags</h3>
            <p>The AddLanguageDir and AddLanguageSuffix directives add support for a single language and so a typical Appweb
            configuration file will have multiple such directives. These directives specify the language via
            a language tag as defined by <a href="http://www.faqs.org/rfcs/rfc1766.html">RFC 1766 &mdash; Tags for the 
            identification of Languages</a> and country codes defined 
            in <a href="http://www.iso.org/iso/iso-3166-1_decoding_table">ISO 3166-1</a>.</p>
            <h3>AddLanguageDir Directive</h3>
            <p>The AddLanguageDir directive is used when language content is stored in separate directories. This directive 
            defines a supported language 
            <a href="#isotag">tag</a> 
            with an associated directory of language for 
            the language specific content. 
            When a client request is received, the appropriate language directory will be selected by the routing engine
            using the language specified by the client's <em>Accept-Language</em> HTTP header.</p>
<pre class="ui code segment">
&lt;Route /info/&gt;
    AddLanguageDir en /path/to/english-docs
&lt;/Route&gt;
</pre>
            <h3>AddLanguageSuffix Directive</h3>
            <p>The AddLanguageSuffix directive defines a supported language 
            <a href="#isotag">tag</a> with an associated filename suffix. When
            a client request is received, the appropriate language will be selected using the language
            specified by the client's <em>Accept-Language</em> HTTP header. Then the document filename will be constructed
            using the language suffix. The suffix can be positioned either before or after the document
            extension via the directives "position" argument.</p>
<pre class="ui code segment">
&lt;Route /info/&gt;
    AddLanguageSuffix en eng before
&lt;/Route&gt;
</pre>
            <p>With this configuration, a request for <em>/index.html</em> will resolve to <em>index.eng.html</em>.</p>
            <h3>DefaultLanguage</h3>
            <p>The DefaultLanguage directive defines the language to use when the the client <em>Accept-Language</em>
            HTTP header is either absent or requests a non-supported language.</p>
<pre class="ui code segment">
&lt;Route /&gt;
    DefaultLanguage en
&lt;/Route&gt;
</pre>
